﻿using System;
using System.ComponentModel;
using Newtonsoft.Json;

namespace Ecobee.Net
{
	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum HvacSetMode
	{
		None,
		Off,
		Auto,
		AuxHeatOnly,
		Cool,
		Heat
	}

	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum VentilatorSetMode
	{
		None,
		Auto,
		MinOnTime,
		On,
		Off
	}

	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum HumidifierSetMode
	{
		None,
		Auto,
		Manual,
		Off
	}

	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum HoldEndTime
	{
		None,
		UseEndTime,
		UseEndTime2hour,
		UseEndTime4hour,
		NextPeriod,
		Indefinite,
		UpdateProgram,
		AskMe
	}

	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum DehumidifierSetMode
	{
		None,
		Auto,
		Manual,
		Off
	}

	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	public enum VentilatorType
	{
		None,
		Ventilator,
		Hrv,
		Erv
	}

	/// <summary>
	/// The Settings contains all the configuration properties of the thermostat.
	/// </summary>
	[JsonObject(Id = "settings")]
	public class Settings : ApiObject
	{
		#region Private Fields
		private HvacSetMode _hvacMode = HvacSetMode.None;
		private DateTime? _lastServiceDate = null;
		private bool _serviceRemindMe = false;
		private int _monthsBetweenService = 0;
		private DateTime? _remindMeDate = null;
		private VentilatorSetMode _vent = VentilatorSetMode.None;
		private int _ventilatorMinOnTime = 0;
		private bool _serviceRemindTechnician = false;
		private string _eiLocation = string.Empty;
		private ApiTemperature _coldTempAlert = ApiTemperature.Empty;
		private bool _coldTempAlertEnabled = false;
		private ApiTemperature _hotTempAlert = ApiTemperature.Empty;
		private bool _hotTempAlertEnabled = false;
		private int _coolStages = 0;
		private int _heatStages = 0;
		private int _maxSetBack = 0;
		private int _maxSetForward = 0;
		private int _quickSaveSetBack = 0;
		private int _quickSaveSetForward = 0;
		private bool _hasHeatPump = false;
		private bool _hasForcedAir = false;
		private bool _hasBoiler = false;
		private bool _hasHumidifier = false;
		private bool _hasErv = false;
		private bool _hasHrv = false;
		private bool _condensationAvoid = false;
		private bool _useCelsius = false;
		private bool _useTimeFormat12 = false;
		private string _locale = string.Empty;
		private string _humidity = string.Empty;
		private HumidifierSetMode _humidifierMode = HumidifierSetMode.None;
		private int _backlightOnIntensity = 0;
		private int _backlightSleepIntensity = 0;
		private int _backlightOffTime = 0;
		private int _soundTickVolume = 0;
		private int _soundAlertVolume = 0;
		private int _compressorProtectionMinTime = 0;
		private int _compressorProtectionMinTemp = 0;
		private ApiTemperature _stage1HeatingDifferentialTemp = ApiTemperature.Empty;
		private ApiTemperature _stage1CoolingDifferentialTemp = ApiTemperature.Empty;
		private int _stage1HeatingDissipationTime = 0;
		private int _stage1CoolingDissipationTime = 0;
		private bool _heatPumpReversalOnCool = false;
		private bool _fanControlRequired = false;
		private int _fanMinOnTime = 0;
		private int _heatCoolMinDelta = 0;
		private int _tempCorrection = 0;
		private HoldEndTime _holdAction = HoldEndTime.None;
		private bool _heatPumpGroundWater = false;
		private bool _hasElectric = false;
		private bool _hasDehumidifier = false;
		private DehumidifierSetMode _dehumidifierMode = DehumidifierSetMode.None;
		private int _dehumidifierLevel = 0;
		private bool _dehumidifyWithAc = false;
		private bool _autoHeatCoolFeatureEnabled = false;
		private bool _wifiOfflineAlert = false;
		private ApiTemperature _heatMinTemp = ApiTemperature.Empty;
		private ApiTemperature _heatMaxTemp = ApiTemperature.Empty;
		private ApiTemperature _coolMinTemp = ApiTemperature.Empty;
		private ApiTemperature _coolMaxTemp = ApiTemperature.Empty;
		private ApiTemperature _heatRangeHigh = ApiTemperature.Empty;
		private ApiTemperature _heatRangeLow = ApiTemperature.Empty;
		private ApiTemperature _coolRangeHigh = ApiTemperature.Empty;
		private ApiTemperature _coolRangeLow = ApiTemperature.Empty;
		private string _userAccessCode = string.Empty;
		private int _userAccessSetting = 0;
		private int _auxRuntimeAlert = 0;
		private ApiTemperature _auxOutdoorTempAlert = ApiTemperature.Empty;
		private ApiTemperature _auxMaxOutdoorTemp = ApiTemperature.Empty;
		private bool _auxRuntimeAlertNotify = false;
		private bool _auxOutdoorTempAlertNotify = false;
		private bool _auxRuntimeAlertNotifyTechnician = false;
		private bool _auxOutdoorTempAlertNotifyTechnician = false;
		private bool _disablePreHeating = false;
		private bool _disablePreCooling = false;
		private bool _installerCodeRequired = false;
		private string _drAccept = string.Empty;
		private bool _isRentalProperty = false;
		private bool _useZoneController = false;
		private int _randomStartDelayCool = 0;
		private int _randomStartDelayHeat = 0;
		private int _humidityHighAlert = 0;
		private int _humidityLowAlert = 0;
		private bool _disableHeatPumpAlerts = false;
		private bool _disableAlertsOnIdt = false;
		private bool _humidityAlertNotify = false;
		private bool _humidityAlertNotifyTechnician = false;
		private bool _tempAlertNotify = false;
		private bool _tempAlertNotifyTechnician = false;
		private int _monthlyElectricityBillLimit = 0;
		private bool _enableElectricityBillAlert = false;
		private bool _enableProjectedElectricityBillAlert = false;
		private int _elecricityBillingDayOfMonth = 0;
		private int _electricityBillCycleMonths = 0;
		private int _electricityBillStartMonth = 0;
		#endregion

		private int _ventilatorMinOnTimeHome = 0;
		private int _ventilatorMinOnTimeAway = 0;
		private bool _backlightOffDuringSleep = false;
		private bool _autoAway = false;
		private bool _smartCirculation = false;
		private bool _followMeComfort = false;
		private VentilatorType _ventilatorType = VentilatorType.None;
		private bool _isVentilatorTimerOn = false;
		private DateTime? _ventilatorOffDateTime = null;
		private bool _hasUVFilter = false;
		private bool _coolingLockout = false;
		private string _groupRef = string.Empty;
		private string _groupName = string.Empty;
		private int _groupSetting = 0;

		#region Public Members
		/// <summary>
		/// The current HVAC mode the thermostat is in. Values: auto, auxHeatOnly, cool, heat, off. 
		/// </summary>
		[JsonProperty(PropertyName = "hvacMode", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(HvacSetMode.None)]
		public HvacSetMode HvacMode
		{
			get
			{
				return _hvacMode;
			}
			set
			{
				_hvacMode = value;
			}
		}

		/// <summary>
		/// The last service date of the HVAC equipment.
		/// </summary>
		[JsonProperty(PropertyName = "lastServiceDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(null)]
		public DateTime? LastServiceDate
		{
			get
			{
				return _lastServiceDate;
			}
			set
			{
				_lastServiceDate = value;
			}
		}

		/// <summary>
		/// Whether to send an alert when service is required again.
		/// </summary>
		[JsonProperty(PropertyName = "serviceRemindMe", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool ServiceRemindMe
		{
			get
			{
				return _serviceRemindMe;
			}
			set
			{
				_serviceRemindMe = value;
			}
		}

		/// <summary>
		/// The user configured monthly interval between HVAC service reminders.
		/// </summary>
		[JsonProperty(PropertyName = "monthsBetweenService", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int MonthsBetweenService
		{
			get
			{
				return _monthsBetweenService;
			}
			set
			{
				_monthsBetweenService = value;
			}
		}

		/// <summary>
		/// Date to be reminded about the next HVAC service date.
		/// </summary>
		[JsonProperty(PropertyName = "remindMeDate", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(null)]
		public DateTime? RemindMeDate
		{
			get
			{
				return _remindMeDate;
			}
			set
			{
				_remindMeDate = value;
			}
		}

		/// <summary>
		/// The ventilator mode. Values: auto, minontime, on, off.
		/// </summary>
		[JsonProperty(PropertyName = "vent", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(VentilatorSetMode.None)]
		public VentilatorSetMode Vent
		{
			get
			{
				return _vent;
			}
			set
			{
				_vent = value;
			}
		}

		/// <summary>
		/// The minimum time in minutes the ventilator is configured to run. The thermostat will always guarantee 
		/// that the ventilator runs for this minimum duration whenever engaged.
		/// </summary>
		[JsonProperty(PropertyName = "ventilatorMinOnTime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int VentilatorMinOnTime
		{
			get
			{
				return _ventilatorMinOnTime;
			}
			set
			{
				_ventilatorMinOnTime = value;
			}
		}

		/// <summary>
		/// Whether the technician associated with this thermostat should receive the HVAC service reminders as well. 
		/// </summary>
		[JsonProperty(PropertyName = "serviceRemindTechnician", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool ServiceRemindTechnician
		{
			get
			{
				return _serviceRemindTechnician;
			}
			set
			{
				_serviceRemindTechnician = value;
			}
		}

		/// <summary>
		/// A note about the physical location where the SMART or EMS Equipment Interface module is located. 
		/// </summary>
		[JsonProperty(PropertyName = "eiLocation", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue("")]
		public string EiLocation
		{
			get
			{
				return _eiLocation;
			}
			set
			{
				_eiLocation = value;
			}
		}

		/// <summary>
		/// The temperature at which a cold temp alert is triggered. 
		/// </summary>
		[JsonProperty(PropertyName = "coldTempAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature ColdTempAlert
		{
			get
			{
				return _coldTempAlert;
			}
			set
			{
				_coldTempAlert = value;
			}
		}

		/// <summary>
		/// Whether cold temperature alerts are enabled. 
		/// </summary>
		[JsonProperty(PropertyName = "coldTempAlertEnabled", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool ColdTempAlertEnabled
		{
			get
			{
				return _coldTempAlertEnabled;
			}
			set
			{
				_coldTempAlertEnabled = value;
			}
		}

		/// <summary>
		/// The temperature at which a hot temp alert is triggered. 
		/// </summary>
		[JsonProperty(PropertyName = "hotTempAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature HotTempAlert
		{
			get
			{
				return _hotTempAlert;
			}
			set
			{
				_hotTempAlert = value;
			}
		}

		/// <summary>
		/// Whether hot temperature alerts are enabled. 
		/// </summary>
		[JsonProperty(PropertyName = "hotTempAlertEnabled", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HotTempAlertEnabled
		{
			get
			{
				return _hotTempAlertEnabled;
			}
			set
			{
				_hotTempAlertEnabled = value;
			}
		}

		/// <summary>
		/// The number of cool stages the connected HVAC equipment supports.
		/// </summary>
		[JsonProperty(PropertyName = "coolStages", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int CoolStages
		{
			get
			{
				return _coolStages;
			}
			set
			{
				_coolStages = value;
			}
		}

		/// <summary>
		/// The number of heat stages the connected HVAC equipment supports.
		/// </summary>
		[JsonProperty(PropertyName = "heatStages", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int HeatStages
		{
			get
			{
				return _heatStages;
			}
			set
			{
				_heatStages = value;
			}
		}

		/// <summary>
		/// The maximum automated set point set back offset allowed in degrees.
		/// </summary>
		[JsonProperty(PropertyName = "maxSetBack", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int MaxSetBack
		{
			get
			{
				return _maxSetBack;
			}
			set
			{
				_maxSetBack = value;
			}
		}

		/// <summary>
		/// The maximum automated set point set forward offset allowed in degrees.
		/// </summary>
		[JsonProperty(PropertyName = "maxSetForward", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int MaxSetForward
		{
			get
			{
				return _maxSetForward;
			}
			set
			{
				_maxSetForward = value;
			}
		}

		/// <summary>
		/// The set point set back offset, in degrees, configured for a quick save event.
		/// </summary>
		[JsonProperty(PropertyName = "quickSaveSetBack", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int QuickSaveSetBack
		{
			get
			{
				return _quickSaveSetBack;
			}
			set
			{
				_quickSaveSetBack = value;
			}
		}

		/// <summary>
		/// The set point set forward offset, in degrees, configured for a quick save event.
		/// </summary>
		[JsonProperty(PropertyName = "quickSaveSetForward", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public int QuickSaveSetForward
		{
			get
			{
				return _quickSaveSetForward;
			}
			set
			{
				_quickSaveSetForward = value;
			}
		}

		/// <summary>
		/// Whether the thermostat is controlling a heat pump.
		/// </summary>
		[JsonProperty(PropertyName = "hasHeatPump", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasHeatPump
		{
			get
			{
				return _hasHeatPump;
			}
		}

		/// <summary>
		/// Whether the thermostat is controlling a forced air furnace.
		/// </summary>
		[JsonProperty(PropertyName = "hasForcedAir", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasForcedAir
		{
			get
			{
				return _hasForcedAir;
			}
		}

		/// <summary>
		/// Whether the thermostat is controlling a boiler.
		/// </summary>
		[JsonProperty(PropertyName = "hasBoiler", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasBoiler
		{
			get
			{
				return _hasBoiler;
			}
		}

		/// <summary>
		/// Whether the thermostat is controlling a humidifier.
		/// </summary>
		[JsonProperty(PropertyName = "hasHumidifier", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasHumidifier
		{
			get
			{
				return _hasHumidifier;
			}
		}

		/// <summary>
		/// Whether the thermostat is controlling an energy recovery ventilator.
		/// </summary>
		[JsonProperty(PropertyName = "hasErv", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasErv
		{
			get
			{
				return _hasErv;
			}
		}

		/// <summary>
		/// Whether the thermostat is controlling a heat recovery ventilator.
		/// </summary>
		[JsonProperty(PropertyName = "hasHrv", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasHrv
		{
			get
			{
				return _hasHrv;
			}
		}

		/// <summary>
		/// Whether the thermostat is in frost control mode.
		/// </summary>
		[JsonProperty(PropertyName = "condensationAvoid", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool CondensationAvoid
		{
			get
			{
				return _condensationAvoid;
			}
			set
			{
				_condensationAvoid = value;
			}
		}

		/// <summary>
		/// Whether the thermostat is using 12hr time format.
		/// </summary>
		[JsonProperty(PropertyName = "useTimeFormat12", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool UseTimeFormat12
		{
			get
			{
				return _useTimeFormat12;
			}
			set
			{
				_useTimeFormat12 = value;
			}
		}

		/// <summary>
		/// Whether the thermostat is configured to report in degrees Celsius.
		/// </summary>
		[JsonProperty(PropertyName = "useCelsius", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool UseCelsius
		{
			get
			{
				return _useCelsius;
			}
			set
			{
				_useCelsius = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "locale", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue("")]
		public string Locale
		{
			get
			{
				return _locale;
			}
			set
			{
				_locale = value;
			}
		}

		/// <summary>
		/// The minimum humidity level (in percent) set point for the humidifier.
		/// </summary>
		[JsonProperty(PropertyName = "humidity", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue("")]
		public string Humidity
		{
			get
			{
				return _humidity;
			}
			set
			{
				_humidity = value;
			}
		}

		/// <summary>
		/// Humidifier mode. Values: auto, manual, off. 
		/// </summary>
		[JsonProperty(PropertyName = "humidifierMode", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(HumidifierSetMode.None)]
		public HumidifierSetMode HumidifierMode
		{
			get
			{
				return _humidifierMode;
			}
			set
			{
				_humidifierMode = value;
			}
		}

		/// <summary>
		/// The thermostat backlight intensity when on. A value between 1 and 10.
		/// </summary>
		[JsonProperty(PropertyName = "backlightOnIntensity", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int BacklightOnIntensity
		{
			get
			{
				return _backlightOnIntensity;
			}
			set
			{
				_backlightOnIntensity = value;
			}
		}

		/// <summary>
		/// The thermostat backlight intensity when asleep. A value between 1 and 10.
		/// </summary>
		[JsonProperty(PropertyName = "backlightSleepIntensity", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int BacklightSleepIntensity
		{
			get
			{
				return _backlightSleepIntensity;
			}
			set
			{
				_backlightSleepIntensity = value;
			}
		}

		/// <summary>
		/// The time in seconds before the thermostat screen goes into sleep mode.
		/// </summary>
		[JsonProperty(PropertyName = "backlightOffTime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int BacklightOffTime
		{
			get
			{
				return _backlightOffTime;
			}
			set
			{
				_backlightOffTime = value;
			}
		}

		/// <summary>
		/// The volume level for key presses on the thermostat. A value between 1 and 10.
		/// </summary>
		[JsonProperty(PropertyName = "soundTickVolume", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int SoundTickVolume
		{
			get
			{
				return _soundTickVolume;
			}
			set
			{
				_soundTickVolume = value;
			}
		}

		/// <summary>
		/// The volume level for alerts on the thermostat. A value between 1 and 10.
		/// </summary>
		[JsonProperty(PropertyName = "soundAlertVolume", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int SoundAlertVolume
		{
			get
			{
				return _soundAlertVolume;
			}
			set
			{
				_soundAlertVolume = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "compressorProtectionMinTime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int CompressorProtectionMinTime
		{
			get
			{
				return _compressorProtectionMinTime;
			}
			set
			{
				_compressorProtectionMinTime = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "compressorProtectionMinTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int CompressorProtectionMinTemp
		{
			get
			{
				return _compressorProtectionMinTemp;
			}
			set
			{
				_compressorProtectionMinTemp = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "stage1HeatingDifferentialTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int Stage1HeatingDifferentialTemp
		{
			get
			{
				return _stage1HeatingDifferentialTemp;
			}
			set
			{
				_stage1HeatingDifferentialTemp = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "stage1CoolingDifferentialTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int Stage1CoolingDifferentialTemp
		{
			get
			{
				return _stage1CoolingDifferentialTemp;
			}
			set
			{
				_stage1CoolingDifferentialTemp = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "stage1HeatingDissipationTime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int Stage1HeatingDissipationTime
		{
			get
			{
				return _stage1HeatingDissipationTime;
			}
			set
			{
				_stage1HeatingDissipationTime = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "stage1CoolingDissipationTime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int Stage1CoolingDissipationTime
		{
			get
			{
				return _stage1CoolingDissipationTime;
			}
			set
			{
				_stage1CoolingDissipationTime = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "heatPumpReversalOnCool", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HeatPumpReversalOnCool
		{
			get
			{
				return _heatPumpReversalOnCool;
			}
			set
			{
				_heatPumpReversalOnCool = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "fanControlRequired", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool FanControlRequired
		{
			get
			{
				return _fanControlRequired;
			}
			set
			{
				_fanControlRequired = value;
			}
		}

		/// <summary>
		/// The minimum time, in minutes, to run the fan each hour. Value from 1 to 60.
		/// </summary>
		[JsonProperty(PropertyName = "fanMinOnTime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int FanMinOnTime
		{
			get
			{
				return _fanMinOnTime;
			}
			set
			{
				_fanMinOnTime = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "heatCoolMinDelta", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int HeatCoolMinDelta
		{
			get
			{
				return _heatCoolMinDelta;
			}
			set
			{
				_heatCoolMinDelta = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "tempCorrection", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int TempCorrection
		{
			get
			{
				return _tempCorrection;
			}
			set
			{
				_tempCorrection = value;
			}
		}

		/// <summary>
		/// The default end time setting the thermostat applies to user temperature holds. Values useEndTime, useEndTime2hour, nextPeriod, indefinite, updateProgram, askMe
		/// </summary>
		[JsonProperty(PropertyName = "holdAction", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(HoldEndTime.None)]
		public HoldEndTime HoldAction
		{
			get
			{
				return _holdAction;
			}
			set
			{
				_holdAction = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "heatPumpGroundWater", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HeatPumpGroundWater
		{
			get
			{
				return _heatPumpGroundWater;
			}
		}

		/// <summary>
		/// Whether the thermostat is connected to an electric HVAC system.
		/// </summary>
		[JsonProperty(PropertyName = "hasElectric", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasElectric
		{
			get
			{
				return _hasElectric;
			}
		}

		/// <summary>
		/// Whether the thermostat is connected to a dehumidifier.
		/// </summary>
		[JsonProperty(PropertyName = "hasDehumidifier", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HasDehumidifier
		{
			get
			{
				return _hasDehumidifier;
			}
		}

		/// <summary>
		/// The dehumidifier mode. Values: auto, manual, off. 
		/// </summary>
		[JsonProperty(PropertyName = "dehumidifierMode", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(DehumidifierSetMode.None)]
		public DehumidifierSetMode DehumidifierMode
		{
			get
			{
				return _dehumidifierMode;
			}
			set
			{
				_dehumidifierMode = value;
			}
		}

		/// <summary>
		/// The dehumidification set point in percentage.
		/// </summary>
		[JsonProperty(PropertyName = "dehumidifierLevel", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int DehumidifierLevel
		{
			get
			{
				return _dehumidifierLevel;
			}
			set
			{
				_dehumidifierLevel = value;
			}
		}

		/// <summary>
		/// Whether the thermostat should use AC overcool to dehumidify. 
		/// </summary>
		[JsonProperty(PropertyName = "dehumidifyWithAc", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool DehumidifyWithAc
		{
			get
			{
				return _dehumidifyWithAc;
			}
			set
			{
				_dehumidifyWithAc = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "autoHeatCoolFeatureEnabled", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool AutoHeatCoolFeatureEnabled
		{
			get
			{
				return _autoHeatCoolFeatureEnabled;
			}
			set
			{
				_autoHeatCoolFeatureEnabled = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "wifiOfflineAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool WifiOfflineAlert
		{
			get
			{
				return _wifiOfflineAlert;
			}
			set
			{
				_wifiOfflineAlert = value;
			}
		}

		/// <summary>
		/// The minimum heat set point allowed by the thermostat firmware.
		/// </summary>
		[JsonProperty(PropertyName = "heatMinTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature HeatMinTemp
		{
			get
			{
				return _heatMinTemp;
			}
		}

		/// <summary>
		/// The maximum heat set point allowed by the thermostat firmware.
		/// </summary>
		[JsonProperty(PropertyName = "heatMaxTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature HeatMaxTemp
		{
			get
			{
				return _heatMaxTemp;
			}
		}

		/// <summary>
		/// The minimum cool set point allowed by the thermostat firmware.
		/// </summary>
		[JsonProperty(PropertyName = "coolMinTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature CoolMinTemp
		{
			get
			{
				return _coolMinTemp;
			}
		}

		/// <summary>
		/// The maximum cool set point allowed by the thermostat firmware.
		/// </summary>
		[JsonProperty(PropertyName = "coolMaxTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature CoolMaxTemp
		{
			get
			{
				return _coolMaxTemp;
			}
		}

		/// <summary>
		/// The maximum heat set point configured by the user's preferences.
		/// </summary>
		[JsonProperty(PropertyName = "heatRangeHigh", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature HeatRangeHigh
		{
			get
			{
				return _heatRangeHigh;
			}
			set
			{
				_heatRangeHigh = value;
			}
		}

		/// <summary>
		/// The minimum heat set point configured by the user's preferences.
		/// </summary>
		[JsonProperty(PropertyName = "heatRangeLow", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature HeatRangeLow
		{
			get
			{
				return _heatRangeLow;
			}
			set
			{
				_heatRangeLow = value;
			}
		}

		/// <summary>
		/// The maximum cool set point configured by the user's preferences.
		/// </summary>
		[JsonProperty(PropertyName = "coolRangeHigh", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature CoolRangeHigh
		{
			get
			{
				return _coolRangeHigh;
			}
			set
			{
				_coolRangeHigh = value;
			}
		}

		/// <summary>
		/// The minimum heat set point configured by the user's preferences.
		/// </summary>
		[JsonProperty(PropertyName = "actualTemperature", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature CoolRangeLow
		{
			get
			{
				return _coolRangeLow;
			}
			set
			{
				_coolRangeLow = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "userAccessCode", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue("")]
		public string UserAccessCode
		{
			get
			{
				return _userAccessCode;
			}
			set
			{
				_userAccessCode = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "userAccessSetting", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int UserAccessSetting
		{
			get
			{
				return _userAccessSetting;
			}
			set
			{
				_userAccessSetting = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxRuntimeAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int AuxRuntimeAlert
		{
			get
			{
				return _auxRuntimeAlert;
			}
			set
			{
				_auxRuntimeAlert = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxOutdoorTempAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature AuxOutdoorTempAlert
		{
			get
			{
				return _auxOutdoorTempAlert;
			}
			set
			{
				_auxOutdoorTempAlert = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxMaxOutdoorTemp", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValueConverter(typeof(ApiTemperature), typeof(ApiTemperatureDefaultConverter), 0F)]
		public ApiTemperature AuxMaxOutdoorTemp
		{
			get
			{
				return _auxMaxOutdoorTemp;
			}
			set
			{
				_auxMaxOutdoorTemp = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxRuntimeAlertNotify", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool AuxRuntimeAlertNotify
		{
			get
			{
				return _auxRuntimeAlertNotify;
			}
			set
			{
				_auxRuntimeAlertNotify = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxOutdoorTempAlertNotify", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool AuxOutdoorTempAlertNotify
		{
			get
			{
				return _auxOutdoorTempAlertNotify;
			}
			set
			{
				_auxOutdoorTempAlertNotify = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxRuntimeAlertNotifyTechnician", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool AuxRuntimeAlertNotifyTechnician
		{
			get
			{
				return _auxRuntimeAlertNotifyTechnician;
			}
			set
			{
				_auxRuntimeAlertNotifyTechnician = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "auxOutdoorTempAlertNotifyTechnician", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool AuxOutdoorTempAlertNotifyTechnician
		{
			get
			{
				return _auxOutdoorTempAlertNotifyTechnician;
			}
			set
			{
				_auxOutdoorTempAlertNotifyTechnician = value;
			}
		}

		/// <summary>
		/// Whether the thermostat should use pre heating to reach the set point on time.
		/// </summary>
		[JsonProperty(PropertyName = "disablePreHeating", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool DisablePreHeating
		{
			get
			{
				return _disablePreHeating;
			}
			set
			{
				_disablePreHeating = value;
			}
		}

		/// <summary>
		/// Whether the thermostat should use pre cooling to reach the set point on time. 
		/// </summary>
		[JsonProperty(PropertyName = "disablePreCooling", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool DisablePreCooling
		{
			get
			{
				return _disablePreCooling;
			}
			set
			{
				_disablePreCooling = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "installerCodeRequired", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool InstallerCodeRequired
		{
			get
			{
				return _installerCodeRequired;
			}
			set
			{
				_installerCodeRequired = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "drAccept", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue("")]
		public string DrAccept
		{
			get
			{
				return _drAccept;
			}
			set
			{
				_drAccept = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "isRentalProperty", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool IsRentalProperty
		{
			get
			{
				return _isRentalProperty;
			}
			set
			{
				_isRentalProperty = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		[JsonProperty(PropertyName = "useZoneController", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool UseZoneController
		{
			get
			{
				return _useZoneController;
			}
			set
			{
				_useZoneController = value;
			}
		}

		/// <summary>
		/// Whether random start delay is enabled for cooling.
		/// </summary>
		[JsonProperty(PropertyName = "randomStartDelayCool", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public int RandomStartDelayCool
		{
			get
			{
				return _randomStartDelayCool;
			}
			set
			{
				_randomStartDelayCool = value;
			}
		}

		/// <summary>
		/// Whether random start delay is enabled for heating.
		/// </summary>
		[JsonProperty(PropertyName = "randomStartDelayHeat", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int RandomStartDelayHeat
		{
			get
			{
				return _randomStartDelayHeat;
			}
			set
			{
				_randomStartDelayHeat = value;
			}
		}

		/// <summary>
		/// The humidity level to trigger a high humidity alert.
		/// </summary>
		[JsonProperty(PropertyName = "humidityHighAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int HumidityHighAlert
		{
			get
			{
				return _humidityHighAlert;
			}
			set
			{
				_humidityHighAlert = value;
			}
		}

		/// <summary>
		/// The humidity level to trigger a low humidity alert.
		/// </summary>
		[JsonProperty(PropertyName = "humidityLowAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int HumidityLowAlert
		{
			get
			{
				return _humidityLowAlert;
			}
			set
			{
				_humidityLowAlert = value;
			}
		}

		/// <summary>
		/// Whether heat pump alerts are disabled.
		/// </summary>
		[JsonProperty(PropertyName = "disableHeatPumpAlerts", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool DisableHeatPumpAlerts
		{
			get
			{
				return _disableHeatPumpAlerts;
			}
			set
			{
				_disableHeatPumpAlerts = value;
			}
		}

		/// <summary>
		/// Whether alerts are disabled from showing on the thermostat.
		/// </summary>
		[JsonProperty(PropertyName = "disableAlertsOnIdt", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool DisableAlertsOnIdt
		{
			get
			{
				return _disableAlertsOnIdt;
			}
			set
			{
				_disableAlertsOnIdt = value;
			}
		}

		/// <summary>
		/// Whether humidification alerts are enabled to the thermostat owner.
		/// </summary>
		[JsonProperty(PropertyName = "humidityAlertNotify", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HumidityAlertNotify
		{
			get
			{
				return _humidityAlertNotify;
			}
			set
			{
				_humidityAlertNotify = value;
			}
		}

		/// <summary>
		/// Whether humidification alerts are enabled to the technician associated with the thermostat.
		/// </summary>
		[JsonProperty(PropertyName = "humidityAlertNotifyTechnician", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool HumidityAlertNotifyTechnician
		{
			get
			{
				return _humidityAlertNotifyTechnician;
			}
			set
			{
				_humidityAlertNotifyTechnician = value;
			}
		}

		/// <summary>
		/// Whether temperature alerts are enabled to the thermostat owner.
		/// </summary>
		[JsonProperty(PropertyName = "tempAlertNotify", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool TempAlertNotify
		{
			get
			{
				return _tempAlertNotify;
			}
			set
			{
				_tempAlertNotify = value;
			}
		}

		/// <summary>
		/// Whether temperature alerts are enabled to the technician associated with the thermostat.
		/// </summary>
		[JsonProperty(PropertyName = "tempAlertNotifyTechnician", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool TempAlertNotifyTechnician
		{
			get
			{
				return _tempAlertNotifyTechnician;
			}
			set
			{
				_tempAlertNotifyTechnician = value;
			}
		}

		/// <summary>
		/// The dollar amount the owner specifies for their desired maximum electricity bill.
		/// </summary>
		[JsonProperty(PropertyName = "monthlyElectricityBillLimit", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int MonthlyElectricityBillLimit
		{
			get
			{
				return _monthlyElectricityBillLimit;
			}
			set
			{
				_monthlyElectricityBillLimit = value;
			}
		}

		/// <summary>
		/// Whether electricity bill alerts are enabled.
		/// </summary>
		[JsonProperty(PropertyName = "enableElectricityBillAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool EnableElectricityBillAlert
		{
			get
			{
				return _enableElectricityBillAlert;
			}
			set
			{
				_enableElectricityBillAlert = value;
			}
		}

		/// <summary>
		/// Whether electricity bill projection alerts are enabled.
		/// </summary>
		[JsonProperty(PropertyName = "enableProjectedElectricityBillAlert", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(false)]
		public bool EnableProjectedElectricityBillAlert
		{
			get
			{
				return _enableProjectedElectricityBillAlert;
			}
			set
			{
				_enableProjectedElectricityBillAlert = value;
			}
		}

		/// <summary>
		/// The day of the month the owner's electricity usage is billed.
		/// </summary>
		[JsonProperty(PropertyName = "elecricityBillingDayOfMonth", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int ElecricityBillingDayOfMonth
		{
			get
			{
				return _elecricityBillingDayOfMonth;
			}
			set
			{
				_elecricityBillingDayOfMonth = value;
			}
		}

		/// <summary>
		/// The owners billing cycle duration in months.
		/// </summary>
		[JsonProperty(PropertyName = "electricityBillCycleMonths", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int ElectricityBillCycleMonths
		{
			get
			{
				return _electricityBillCycleMonths;
			}
			set
			{
				_electricityBillCycleMonths = value;
			}
		}

		/// <summary>
		/// The annual start month of the owners billing cycle.
		/// </summary>
		[JsonProperty(PropertyName = "electricityBillStartMonth", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(0)]
		public int ElectricityBillStartMonth
		{
			get
			{
				return _electricityBillStartMonth;
			}
			set
			{
				_electricityBillStartMonth = value;
			}
		}
		#endregion

		/// <summary>
		/// This read-only field represents the type of ventilator present for the Thermostat. The possible 
		/// values are none, ventilator, hrv, and erv. 
		/// </summary>
		[JsonProperty(PropertyName = "ventilatorType", DefaultValueHandling = DefaultValueHandling.Ignore)]
		[DefaultValue(VentilatorType.None)]
		public VentilatorType VentilatorType
		{
			get
			{
				return _ventilatorType;
			}
		}
	}
}